import { BlankLayout, BasicLayout } from '../../views/layouts'


let baseUrl = process.env.BASE_URL

if (baseUrl.endsWith('/')) {
  baseUrl = baseUrl.substring(0, baseUrl.length - 1)
}
const baseName = baseUrl.substring(1, baseUrl.length)
/**
 * 基础路由
 * @type { *[] }
 */
export const constantRoutes = [
  {
    path: '/',
    name: 'index',
    redirect: baseUrl
  },
  {
    path: baseUrl,
    name: baseName,
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: BlankLayout,
    redirect: '/login/front',
    children: [
      // 首页
      {
        path: '/login/front',
        name: 'login-front',
        component: () => import(/* webpackChunkName: 'login_LoginFront' */ '@/views/login/LoginFront'),
        redirect: '/login/front/home',
        meta: {
          title: '首页'
        },
        children: [
          {
            path: '/login/front/home',
            name: 'login-front-home',
            component: () => import(/* webpackChunkName: 'login_LoginHome' */'@/views/login/LoginHome'),
            meta: {
              title: process.env.VUE_APP_TITLE,
              keepAlive: false
            }
          },
          {
            path: '/login/front/versionUpdate',
            name: 'login-front-versionUpdate',
            component: () => import(/* webpackChunkName: 'login_versionUpdate' */'@/views/defaultPage/VersionUpdate'),
            meta: {
              title: '版本更新',
              keepAlive: true
            }
          }
        ]
      },
      // 登录页
      {
        path: '/login/page',
        name: 'login-page',
        component: () => import(/* webpackChunkName: 'login_LoginPage' */ '@/views/login/LoginPage'),
        redirect: '/login/page/way',
        children: [
          {
            path: '/login/page/way',
            name: 'login-page-way',
            components: {
              login_propaganda: () => import(/* webpackChunkName: 'login_components_LoginPropaganda' */ '@/views/login/components/LoginPropaganda'),
              login_way: () => import(/* webpackChunkName: 'login_components_LoginWay' */ '@/views/login/components/LoginWay')
            },
            meta: {
              title: '登录',
              keepAlive: false
            }
          }
        ]
      }
    ]
  }
  // ,
  // {
  //   path: '/:pathMatch(.*)',
  //   redirect: '/exception'
  // },

]
